<script setup>
import { ref, defineOptions } from 'vue'
import { smallCompile } from '@/api/getAxios'

//小编推荐
const smallcompile = ref({})
smallCompile().then((res) => {
    // console.log(res);
    smallcompile.value = res.data.data
    // console.log(smallcompile.value);
})

</script>
<template>
    <div class="small-compile">
        <h1 class="recommend">
            <span>小编推荐</span>
            <span class="iconfont icon-tiaozhuan jump" @click="$router.push('/smallview')"></span>
        </h1>
        <ul>
            <li @click="$router.push(`/BookInfo?storyId=${smallcompile.storyId}`)">
                <div class="person">
                    <img :src="smallcompile.facePic" alt="">
                    <span class="nickName">{{ smallcompile.nickName }}</span>
                </div>
                <div class="comment">
                    编辑点评：{{ smallcompile.storyComment }}
                </div>
                <div class="story">
                    <img :src="smallcompile.cover" alt="">
                    <div class="info">
                        <span class="name">{{ smallcompile.storyName }}</span>
                        <span class="detail">{{ smallcompile.introduce }}</span>
                        <span class="author-type">{{ smallcompile.authorName }} | {{ smallcompile.storyType }}</span>
                    </div>
                </div>
            </li>
        </ul>
    </div>
</template>

<style scoped lang='less'>
.small-compile {
    height: 84vw;
    background-color: #fff;
    margin-bottom: 15px;

    h1 {
        text-align: center;
        font-weight: bold;
        font-size: 22px;
        padding: 20px 0px;
        position: relative;

        span.jump {
            position: absolute;
            right: 0;
            font-size: 26px;
            margin-right: 20px;
        }
    }

    ul {
        display: flex;
        flex-direction: column;

        li {
            padding: 10px;
            height: 40vw;
            display: flex;
            flex-direction: column;

            .person {
                display: flex;
                align-items: center;

                img {
                    width: 40px;
                    height: 40px;
                    border-radius: 50%;
                }

                .nickName {
                    font-size: 18px;
                    margin-left: 10px;
                }
            }

            .comment {
                margin: 5px 0;
                font-size: 16px;
            }

            .story {
                display: flex;
                width: 90vw;
                margin: 0 auto;
                background-color: #fff;
                border: 1px solid #eee;
                height: 40vw;

                img {
                    height: 100%;
                    width: 25vw;
                }

                .info {
                    text-align: center;
                    margin-left: 20px;
                    display: flex;
                    flex-direction: column;
                    justify-content: space-evenly;
                    .name {
                        font-size: 18px;
                    }
                    .detail {
                        display: -webkit-box;
                        text-align: center;
                        -webkit-line-clamp: 1;
                        -webkit-box-orient: vertical;
                        overflow: hidden;
                        text-overflow: ellipsis;
                        color: #939296;
                        font-size: 14px;
                    }
                    .author-type {
                        color: #939296;
                        font-size: 14px;
                    }
                }
            }
        }
    }
}</style>